package com.zlq.sen;

import com.zlq.pojo.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class HelloSender {
    @Resource
    private AmqpTemplate rabbitTemplate;
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    public void send(User user){
        rabbitTemplate.convertAndSend("user",user);
        System.out.println("晚上时间为"+dateFormat.format(new Date()));
    }
}
